<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
  <style type="text/css">
    #test{
      width: 200px;
      height: 200px;
      background-color: red;
    }
  </style>
</head>
<body>
<div id="test"></div>
<script>
    var view = document.getElementById('test')
    var isBlue = true
    view.onclick = function () {
        alert("点击了div")
    }
    view.onmouseover = function () {
      this.style.backgroundColor = 'blue'
    }
    view.onmouseout = function () {
      this.style.backgroundColor = 'black'
    }

</script>
</body>
</html>